library(ggplot2)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ tibble 3.1.3 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 2.0.1 ✓ forcats 0.5.1
## ✓ purrr 0.3.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(wordcloud)
## Loading required package: RColorBrewer
library(RColorBrewer)
library(wordcloud2)
library(tm)
## Loading required package: NLP
##
## Attaching package: 'NLP'
## The following object is masked from 'package:ggplot2':
##
## annotate
# read data
student <- read.csv('/Users/feiyasuo/Documents/GitHub/consulting-project-pandemic-survey/student.csv')
faculty <- read.csv('/Users/feiyasuo/Documents/GitHub/consulting-project-pandemic-survey/faculty.csv')
student_q1 <- data.frame(table(student[student$q1!='',]$q1)[-1])
student_q1$prop <- student_q1$Freq/sum(student_q1$Freq)
student_q1$sd <- sqrt(student_q1$prop*(1-student_q1$prop)*student_q1$Freq)
ggplot(student_q1) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q1: Preferred Mode of Learning") +
xlab("") +
coord_flip()
student_q2 <- data.frame(table(student[student$q2!='',]$q2))
student_q2 <- student_q2[-1,]
student_q2$prop <- student_q2$Freq/sum(student_q2$Freq)
student_q2$sd <- sqrt(student_q2$prop*(1-student_q2$prop)*student_q2$Freq)
ggplot(student_q2) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q2: Preferred Method of Accessing Lecture Material") +
xlab("") +
coord_flip()
student_q3 <- data.frame(table(student[student$q3!='',]$q3))
student_q3 <- student_q3[-1,]
student_q3$prop <- student_q3$Freq/sum(student_q3$Freq)
student_q3$sd <- sqrt(student_q3$prop*(1-student_q3$prop)*student_q3$Freq)
ggplot(student_q3) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q3: How often will you attend in-person lectures") +
xlab("") +
coord_flip()
student_q6 <- data.frame(table(student[student$q6!='',]$q6))
student_q6 <- student_q6[-1,]
student_q6$Var1 <- factor(student_q6$Var1, levels = c("Very easy", "Easy",
"Neither difficult nor easy", "Difficult",
"Very difficult"))
student_q6$prop <- student_q6$Freq/sum(student_q6$Freq)
student_q6$sd <- sqrt(student_q6$prop*(1-student_q6$prop)*student_q6$Freq)
ggplot(student_q6) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q6: connecting with other students and faculty in small groups") +
xlab("") +
coord_flip()
student_q7 <- data.frame(table(student[student$q7!='',]$q7))
student_q7 <- student_q7[-1,]
student_q7$Var1 <- factor(student_q7$Var1, levels = c("Often", "Sometimes", "Rarely", "Never"))
student_q7$prop <- student_q7$Freq/sum(student_q7$Freq)
student_q7$sd <- sqrt(student_q7$prop*(1-student_q7$prop)*student_q7$Freq)
ggplot(student_q7) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q7: How often did you meet with your small group?") +
xlab("") +
coord_flip()
student_q9 <- data.frame(table(student[student$q9!='',]$q9))
student_q9 <- student_q9[-1,]
student_q9$Var1 <- factor(student_q9$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q9$prop <- student_q9$Freq/sum(student_q9$Freq)
student_q9$sd <- sqrt(student_q9$prop*(1-student_q9$prop)*student_q9$Freq)
ggplot(student_q9) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q9: The virtual curriculum affected your ability for self care") +
xlab("") +
coord_flip()
student_q10 <- data.frame(table(student[student$q10!='',]$q10))
student_q10 <- student_q10[-1,]
student_q10$Var1 <- factor(student_q10$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q10$prop <- student_q10$Freq/sum(student_q10$Freq)
student_q10$sd <- sqrt(student_q10$prop*(1-student_q10$prop)*student_q10$Freq)
ggplot(student_q10) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q10: Virtual activities impacted the quality of your clinical skills education") +
xlab("") +
coord_flip()
student_q11 <- data.frame(table(student[student$q11!='',]$q11))
student_q11 <- student_q11[-1,]
student_q11$Var1 <- factor(student_q11$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q11$prop <- student_q11$Freq/sum(student_q11$Freq)
student_q11$sd <- sqrt(student_q11$prop*(1-student_q11$prop)*student_q11$Freq)
ggplot(student_q11) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q11: COVID-19 affected the extent of your involvement in community service") +
xlab("") +
coord_flip()
student_q12 <- data.frame(table(student[student$q12!='',]$q12))
student_q12 <- student_q12[-1,]
student_q12$Var1 <- factor(student_q12$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q12$prop <- student_q12$Freq/sum(student_q12$Freq)
student_q12$sd <- sqrt(student_q12$prop*(1-student_q12$prop)*student_q12$Freq)
ggplot(student_q12) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q12: Your choice of specialty will be affected due to virtual \n versus in-person interactions with instructorsl") +
xlab("") +
coord_flip()
student_q13 <- data.frame(table(student[student$q13!='',]$q13))
student_q13 <- student_q13[-1,]
student_q13$Var1 <- factor(student_q13$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q13$prop <- student_q13$Freq/sum(student_q13$Freq)
student_q13$sd <- sqrt(student_q13$prop*(1-student_q13$prop)*student_q13$Freq)
ggplot(student_q13) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q13: You were able to connect to students in other class years \n and instructors to identify potential mentors using the Zoom format") +
xlab("") +
coord_flip()
student_q14 <- data.frame(table(student[student$q14!='',]$q14))
student_q14 <- student_q14[-1,]
student_q14$Var1 <- factor(student_q14$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
student_q14$prop <- student_q14$Freq/sum(student_q14$Freq)
student_q14$sd <- sqrt(student_q14$prop*(1-student_q14$prop)*student_q14$Freq)
ggplot(student_q14) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("q14: I feel confident that I belong at UNC School of Medicine") +
xlab("") +
coord_flip()
# Retrieving the text data
student_q4 <- student$q4
docs <- Corpus(VectorSource(student_q4))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
df <- df[-1,]
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
# Retrieving the text data
student_q5 <- student$q5
docs <- Corpus(VectorSource(student_q5))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
df <- df[c(-1,-3,-4),]
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
# Retrieving the text data
student_q15 <- student$q15
docs <- Corpus(VectorSource(student_q15))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : professional could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : activities could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : hard could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : socializing could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : year could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : belong could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : caring could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : competent could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : costume could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : covid could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : curriculum could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : happen could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : imagine could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : intending could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : jaded could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : make could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : makes could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : making could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : physicians could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : prepare could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : really could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : seem could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : seems could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : step could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : traditions could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : want could not be fit on page. It will not be plotted.
faculty_q1 <- data.frame(table(faculty[faculty$q1!='',]$q1))
faculty_q1$prop <- faculty_q1$Freq/sum(faculty_q1$Freq)
faculty_q1$sd <- sqrt(faculty_q1$prop*(1-faculty_q1$prop)*faculty_q1$Freq)
ggplot(faculty_q1) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q1: What is your preferred mode of teaching?") +
xlab("") +
coord_flip()
faculty_q6 <- data.frame(table(faculty[faculty$q6!='',]$q6))
faculty_q6$Var1 <- factor(faculty_q6$Var1, levels = c("Very easy", "Easy",
"Neither difficult nor easy", "Difficult",
"Very difficult"))
faculty_q6$prop <- faculty_q6$Freq/sum(faculty_q6$Freq)
faculty_q6$sd <- sqrt(faculty_q6$prop*(1-faculty_q6$prop)*faculty_q6$Freq)
ggplot(faculty_q6) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q6: How easy was it connecting with students in small groups \n over Zoom?") +
xlab("") +
coord_flip()
faculty_q9 <- data.frame(table(faculty[faculty$q9!='',]$q9))
faculty_q9 <- faculty_q9[-1,]
faculty_q9$Var1 <- factor(faculty_q9$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
faculty_q9$prop <- faculty_q9$Freq/sum(faculty_q9$Freq)
faculty_q9$sd <- sqrt(faculty_q9$prop*(1-faculty_q9$prop)*faculty_q9$Freq)
ggplot(faculty_q9) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q9: The virtual curriculum affected your ability for self care") +
xlab("") +
coord_flip()
faculty_q12 <- data.frame(table(faculty[faculty$q12!='',]$q12))
faculty_q12 <- faculty_q12[-1,]
faculty_q12$Var1 <- factor(faculty_q12$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
faculty_q12$prop <- faculty_q12$Freq/sum(faculty_q12$Freq)
faculty_q12$sd <- sqrt(faculty_q12$prop*(1-faculty_q12$prop)*faculty_q12$Freq)
ggplot(faculty_q12) +
geom_bar(aes(x=Var1, y=Freq), stat="identity", fill="skyblue", alpha=0.5) +
geom_errorbar(aes(x=Var1, ymin=Freq-sd*1.96, ymax=Freq+sd*1.96), width=0.4, colour="orange") +
ggtitle("Q12: The virtual curriculum affected your ability for self care") +
xlab("") +
coord_flip()
# Retrieving the text data
faculty_q1_other <- faculty$q1_other
docs <- Corpus(VectorSource(faculty_q1_other))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
## Warning in wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words =
## 200, : pandemic could not be fit on page. It will not be plotted.
# Retrieving the text data
faculty_q4 <- faculty$q4
docs <- Corpus(VectorSource(faculty_q4))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
df <- df[-1,]
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
# Retrieving the text data
faculty_q12_explain <- faculty$q12_explain
docs <- Corpus(VectorSource(faculty_q12_explain))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
# Retrieving the text data
faculty_q16 <- faculty$q16
docs <- Corpus(VectorSource(faculty_q16))
# Clean the text data
docs <- docs %>%
tm_map(removeNumbers) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
## Warning in tm_map.SimpleCorpus(., removeNumbers): transformation drops documents
## Warning in tm_map.SimpleCorpus(., removePunctuation): transformation drops
## documents
## Warning in tm_map.SimpleCorpus(., stripWhitespace): transformation drops
## documents
docs <- tm_map(docs, content_transformer(tolower))
## Warning in tm_map.SimpleCorpus(docs, content_transformer(tolower)):
## transformation drops documents
docs <- tm_map(docs, removeWords, stopwords("english"))
## Warning in tm_map.SimpleCorpus(docs, removeWords, stopwords("english")):
## transformation drops documents
# Create a document-term-matrix
dtm <- TermDocumentMatrix(docs)
matrix <- as.matrix(dtm)
words <- sort(rowSums(matrix),decreasing=TRUE)
df <- data.frame(word = names(words),freq=words)
# Generate the word cloud
set.seed(1234) # for reproducibility
wordcloud(words = df$word, freq = df$freq, min.freq = 1, max.words=200, random.order=FALSE,
rot.per=0.35, colors=brewer.pal(8, "Dark2"))
merge_q1 <- rbind(student_q1, faculty_q1[-4,])
merge_q1$category <- c(rep("student",4), rep("faculty",4))
merge_q1$sd <- sqrt(merge_q1$prop*(1-merge_q1$prop)/merge_q1$Freq)
ggplot(merge_q1, aes(fill=category, y=prop, x=Var1)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(x=Var1, ymin=prop-sd*1.96, ymax=prop+sd*1.96), position = position_dodge(0.95), width=0.4, colour="orange") +
ggtitle("Q1: What is your preferred mode of teaching/leanring") +
xlab("") + ylab("Proportion") +
coord_flip()
merge_q6 <- rbind(student_q6, faculty_q6)
de<-data.frame("Very difficult",0,0,0)
names(de)<-c("Var1","Freq", "prop", "sd")
merge_q6 <- rbind(merge_q6, de)
merge_q6$category <- c(rep("student",5), rep("faculty",5))
merge_q6$Var1 <- factor(merge_q6$Var1, levels = c("Very easy", "Easy",
"Neither difficult nor easy", "Difficult",
"Very difficult"))
merge_q6$sd <- sqrt(merge_q6$prop*(1-merge_q6$prop)/merge_q6$Freq)
ggplot(merge_q6, aes(fill=category, y=prop, x=Var1)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(x=Var1, ymin=prop-sd*1.96, ymax=prop+sd*1.96), position = position_dodge(0.95), width=0.4, colour="orange") +
ggtitle("Q6: How easy was it connecting with faculty/students in small groups over Zoom?") +
xlab("") + ylab("Proportion") +
coord_flip()
merge_q9 <- rbind(student_q9, faculty_q9)
de<-data.frame("Agree",0,0,0)
names(de)<-c("Var1","Freq", "prop", "sd")
merge_q9 <- rbind(merge_q9, de)
merge_q9$Var1 <- factor(merge_q9$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
merge_q9$category <- c(rep("student",5), rep("faculty",5))
merge_q9$sd <- sqrt(merge_q9$prop*(1-merge_q9$prop)/merge_q9$Freq)
ggplot(merge_q9, aes(fill=category, y=prop, x=Var1)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(x=Var1, ymin=prop-sd*1.96, ymax=prop+sd*1.96), position = position_dodge(0.95), width=0.4, colour="orange") +
ggtitle("Q9: The virtual curriculum affected your ability for self care") +
xlab("") + ylab("Proportion") +
coord_flip()
merge_q12 <- rbind(student_q12, faculty_q12)
de<-data.frame("Agree",0,0,0)
names(de)<-c("Var1","Freq", "prop", "sd")
merge_q12 <- rbind(merge_q12, de)
merge_q12$Var1 <- factor(merge_q12$Var1, levels = c("Strongly agree", "Agree", "Neutral",
"Disagree", "Strongly disagree"))
merge_q12$category <- c(rep("student",5), rep("faculty",5))
merge_q12$sd <- sqrt(merge_q12$prop*(1-merge_q12$prop)/merge_q12$Freq)
ggplot(merge_q12, aes(fill=category, y=prop, x=Var1)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(x=Var1, ymin=prop-sd*1.96, ymax=prop+sd*1.96), position = position_dodge(0.95), width=0.4, colour="orange") +
ggtitle("Q12: Speciality was affected by virtual versus inperson interactions") +
xlab("") + ylab("Proportion") +
coord_flip()